import { post, get } from '@/utils/requset'
import type { UserInfo } from '@/types/user'

export function login(data: { username: string; password: string }) {
  return post('/user/login', data)
}

export function getUserInfo(token?: string) {
  return get<UserInfo>('/user/info', { token })
}

export function logout() {
  return post('/user/logout')
}
